package com.smt.take.presenter

import com.smt.take.model.beans.HomeListBean
import com.smt.take.ui.fragment.HomeFragment

class HomeFragmentPresenter(private val homeFragment: HomeFragment) : BasePresenter<HomeListBean>(homeFragment.context) {

    fun getHomeInfo() {
        val homeCall = takeOutService.getHomeInfo()
        homeCall.enqueue(callback)
    }


    override fun setDataToUI(data: HomeListBean?) {
        if (data != null) {
            // 有数据，成功页面
            homeFragment.onHomeSuccess(data)
        } else {
            // 无数据，异常页面
            homeFragment.onHomeFailed()
        }
    }
}